message ( STATUS "Will create TGZ with build for MacOS X" )

if (CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
	set ( CPACK_PACKAGING_INSTALL_PREFIX "/opt/homebrew" )
else ()
	set ( CPACK_PACKAGING_INSTALL_PREFIX "/usr/local" )
endif ()
set ( CMAKE_INSTALL_PREFIX "${CPACK_PACKAGING_INSTALL_PREFIX}" CACHE PATH "prefix from distr build" FORCE )
include ( GNUInstallDirs )

install ( TARGETS galera LIBRARY DESTINATION ${CMAKE_INSTALL_DATADIR}/manticore/modules )

set ( CPACK_ARCHIVE_COMPONENT_INSTALL OFF )
set ( CPACK_GENERATOR "TGZ" )

set ( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${GALERA_VERSION}-${CMAKE_SYSTEM_NAME}-osx${CMAKE_OSX_DEPLOYMENT_TARGET}-${CMAKE_SYSTEM_PROCESSOR}" )
